/***************************************************************************
 创建者: 华磊
 开始时间: 2018.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2017.5.8 类的具体实现代码编写

 ***************************************************************************/
#include "registerinstruction.h"

RegisterInstruction::RegisterInstruction()
{
}

QDataStream& operator <<(QDataStream &out,RegisterInstruction &myVector)
{
    out << (quint32)(myVector.regcondition.size());
    for(int i = 0; i < myVector.regcondition.size();i++)
    {
        out << myVector.regcondition[i];
    }

    out << myVector.comment << myVector.i << myVector.j <<
           (quint32)myVector.type << (quint32)myVector.addressType;

    return out;
}

QDataStream& operator >>(QDataStream &in,RegisterInstruction &myVector)
{
    myVector.regcondition.clear();

    quint32 c;
    in >> c;
    myVector.regcondition.resize(c);

    for(int i = 0; i < c; ++i)
    {
        in >> myVector.regcondition[i];
    }

    quint32 type ;
    quint32 addressType;

    in >> myVector.comment >> myVector.i >>
          myVector.j >> type >> addressType;

    myVector.type = (REG_INS_TYPE)type;
    myVector.addressType = (ADDRESSING_TYPE)addressType;

    return in;
}
